package com.ruoyi.teaching.mapper;

import java.util.List;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.teaching.domain.TeachingPlan;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.joda.time.LocalDate;

/**
 * 教学计划Mapper接口
 *
 * @author sunshine
 * @date 2024-01-30
 */
public interface TeachingPlanMapper extends BaseMapper<TeachingPlan>
{
    /**
     * 查询教学计划
     *
     * @param id 教学计划主键
     * @return 教学计划
     */
    public TeachingPlan selectTeachingPlanById(Long id);

    /**
     * 查询教学计划列表
     *
     * @param teachingPlan 教学计划
     * @return 教学计划集合
     */
    public List<TeachingPlan> selectTeachingPlanList(TeachingPlan teachingPlan);

    /**
     * 新增教学计划
     *
     * @param teachingPlan 教学计划
     * @return 结果
     */
    public int insertTeachingPlan(TeachingPlan teachingPlan);

    /**
     * 修改教学计划
     *
     * @param teachingPlan 教学计划
     * @return 结果
     */
    public int updateTeachingPlan(TeachingPlan teachingPlan);

    /**
     * 删除教学计划
     *
     * @param id 教学计划主键
     * @return 结果
     */
    public int deleteTeachingPlanById(Long id);

    /**
     * 批量删除教学计划
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteTeachingPlanByIds(Long[] ids);

    @Delete("delete from ya_teaching_plan where stage = #{stage}")
    void deleteTeachingPlan(@Param("stage") Integer stage);

    @Select("select id, date, day, course_content, class_name, stage, remarks, weekday, classes_id, course_design_id from  `ya_teaching_plan` where stage =#{stage}")
    List<TeachingPlan> selectTeachingPlanByStage(@Param("stage") Integer stage);




    @Select("select id, date, day, course_content, class_name, stage, remarks, weekday, classes_id, course_design_id from ya_teaching_plan\n" +
            "where date>=#{date} and day")
    List<TeachingPlan> selectTeachingByDayOrDate(@Param("date") String date);

    @Select("select id, date, day, course_content, class_name, stage, remarks, weekday, classes_id, course_design_id from ya_teaching_plan\n" +
            "where date>=#{date}")
    List<TeachingPlan> selectTeachingByDate(@Param("date") String date);

    @Select("select id, date, day, course_content, class_name, stage, remarks, weekday, classes_id, course_design_id from ya_teaching_plan\n" +
            "where day")
    List<TeachingPlan> selectTeachingByDay();

    @Select("select id, date, day, course_content, class_name, stage, remarks, weekday, classes_id, course_design_id from ya_teaching_plan where date = #{now}")
    List<TeachingPlan> selectTeachingPlanListByDate(@Param("now") String now);

    @Select("select id, date, day, course_content, class_name, stage, remarks, weekday, classes_id, course_design_id from ya_teaching_plan where classes_id = #{id}")
    List<TeachingPlan> selectTeachingPlanListById(@Param("id") Long id);
}
